package jm.data.structure.tree;

import jm.data.structure.tree.printer.BinaryTrees;

/**
 * @Description 红黑树测试
 * @date 2022/4/20 15:32
 */
public class RBTreeMain {
    public static void main(String[] args) {
        int[] data = {9, 71, 13, 56, 95, 78, 68, 33, 38, 48, 26, 99, 27, 16, 14, 12, 96, 40, 94};
        RBTree<Integer> rbTree = new RBTree<>();
        for (int i = 0; i < data.length; i++) {
            rbTree.add(data[i]);
        }
        BinaryTrees.println(rbTree);
        for (int i = 0; i < data.length; i++) {
            rbTree.remove(data[i]);
            System.out.println("---------------------------");
            System.out.println("【"+ data[i] +"】");
            BinaryTrees.println(rbTree);
        }
    }
}
